package top.wyloop.intoeins.module.iam.model.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import top.wyloop.intoeins.util.PrimaryKeyGenerator;

import java.util.Date;

/**
 * @author Wyatt6
 * @date 2025/1/31
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tb_iam_permission", indexes = {
        @Index(columnList = "identifier", unique = true)
})
public class Permission {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "PK_generator")
    @GenericGenerator(name = "PK_generator", type = PrimaryKeyGenerator.class)
    private Long id;                // 主键
    @Column
    private String module;          // 模块分组（不能用group，它是MySQL保留字）
    @Column(nullable = false)
    private String identifier;      // 标识符
    @Column
    private String name;            // 名称
    @Column(nullable = false)
    private Boolean activated;      // 启用/禁用
    @Column
    private Date createTime;        // 创建时间
    @Column
    private String remark;          // 备注
}
